package dieci.system;

import dieci.database.PersistentObject;
import dieci.utils.Redondeo;

/**
 *
 * @author DuckSys
 */
public class SaleDetails implements PersistentObject
{

    private long saleId;
    private Product product;
    private int amount;
    private double price;

    public SaleDetails()
    {
    }

    public SaleDetails(Product product, int amount, double price)
    {
        this.product = product;
        this.amount = amount;
        this.price = Redondeo.Redondear(price,2);
    }

    public SaleDetails(long saleId, Product product, int amount, double price)
    {
        this(product, amount, price);
        this.saleId = saleId;
    }

    /**
     * Get the value of price
     *
     * @return the value of price
     */
    public double getPrice()
    {
        return price;
    }

    /**
     * Set the value of price
     *
     * @param price new value of price
     */
    public void setPrice(double price)
    {
        this.price = Redondeo.Redondear(price, 2);
    }

    /**
     * Get the value of amount
     *
     * @return the value of amount
     */
    public int getAmount()
    {
        return amount;
    }

    /**
     * Set the value of amount
     *
     * @param amount new value of amount
     */
    public void setAmount(int amount)
    {
        this.amount = amount;
    }

    /**
     * Get the value of product
     *
     * @return the value of product
     */
    public Product getProduct()
    {
        return product;
    }

    /**
     * Set the value of product
     *
     * @param product new value of product
     */
    public void setProduct(Product product)
    {
        this.product = product;
    }

    /**
     * Get the value of saleId
     *
     * @return the value of saleId
     */
    public long getSaleId()
    {
        return saleId;
    }

    /**
     * Set the value of saleId
     *
     * @param saleId new value of saleId
     */
    public void setSaleId(long saleId)
    {
        this.saleId = saleId;
    }
}
